@extends('layouts.admin')

@section('title', 'User Role')

@section('css')
    <link type="text/css" href="{{cdn('/supervise/assets/plugins/datatables/dataTables.bootstrap.css')}}" rel="stylesheet">
    <link type="text/css" href="{{cdn('/supervise/assets/plugins/datatables/dataTables.themify.css')}}" rel="stylesheet">
@endsection

@section('content')
    <div class="static-content">
        <div class="page-content">
            <ol class="breadcrumb">
                <li class=""><a href="{{url('/admin')}}">Home</a></li>
                <li ><a href="{{url('/admin/user')}}">User</a></li>
                <li class="active"><a href="{{url('/admin/user/role')}}">Role</a></li>
            </ol>
            <div class="container-fluid">
                <div data-widget-group="group1">
                    <div class="row">
                        <div class="row">
                            <div class="col-md-12">
                                <div class="alert alert-info">
                                    可以快速添加用户Role.
                                    <button type="button" class="close" data-dismiss="alert">&times;</button>
                                </div>
                                <div class="panel panel-default" id="panel-editable">
                                    <div class="panel-heading">
                                        <h2>Role</h2>
                                        <div class="panel-ctrls"></div>
                                        {{--<input type="">--}}
                                    </div>
                                    <div class="panel-body no-padding">
                                        <table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered datatables" id="crudtable">
                                            <thead>
                                            <tr>
                                                <th width="5%">ID</th>
                                                <th width="10%">名称</th>
                                                <th width="20%">翻译名称</th>
                                                <th width="18%">介绍</th>
                                                <th width="15%">flag</th>
                                                <th width="12%">等级</th>
                                                <th width="20%">更新日期</th>
                                            </tr>
                                            </thead>
                                        </table>
                                    </div>
                                    <div class="panel-footer"></div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection

@section('js')
    <script type="text/javascript" src="{{cdn('/supervise/assets/plugins/datatables/jquery.dataTables.js')}}"></script>                            <!-- Data Tables -->
    <script type="text/javascript" src="{{cdn('/supervise/assets/plugins/datatables/TableTools.js')}}"></script>                                   <!-- TableTools -->
    <script type="text/javascript" src="{{cdn('/supervise/assets/plugins/jquery-editable/jquery.editable.js')}}"></script>                         <!-- jQuery Editable -->
    <script type="text/javascript" src="{{cdn('/supervise/assets/plugins/datatables/dataTables.editor.js')}}"></script>                            <!-- Data Tables Editor-->
    <script type="text/javascript" src="{{cdn('/supervise/assets/plugins/datatables/dataTables.editor.bootstrap.js')}}"></script>                  <!-- Data Tables Editor for Bootstrap-->
    <script type="text/javascript" src="{{cdn('/supervise/assets/plugins/datatables/dataTables.bootstrap.js')}}"></script>
    <script>
        $(function () {
            editor = new $.fn.dataTable.Editor({
                "ajaxUrl":"/admin/user/role/edit",
                "domTable":"#crudtable",
                "i18n": {
                    "create": {
                        "button": "添加",
                        "title": "添加一个Role",
                        "submit": "提交"
                    },
                    "edit": {
                        "button": "编辑",
                        "title": "删除Role",
                        "submit": "确认"
                    },
                    "remove": {
                        "button": "删除",
                        "title": "删除Role",
                        "submit": "确认",
                        "confirm": {
                            "_": "是否删除这条 %d 数据?",
                            "1": "是否删除这条 1 数据?"
                        }
                    },
                    "error": {
                        "system": "Une erreur s’est produite, contacter l’administrateur système"
                    },
                    "multi": {
                        "title": "Plusieurs valeurs",
                        "info": "Les éléments sélectionnés contiennent des valeurs différentes pour cette entrée. Pour modifier et mettre tous les éléments pour cette entrée pour la même valeur, cliquez ou appuyez ici, sinon ils vont conserver leurs valeurs individuelles.",
                        "restore": "Annuler les modifications"
                    },
                    "datetime": {
                        "previous": '上一页',
                        "next":     '下一页',
                        "months":   [ 'Janvier', 'Février', 'Mars', 'Avril', 'peut', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre' ],
                        "weekdays": [ 'Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam' ]
                    }
                },
                "fields":[{
                        "label":"名称:",
                        "name":"name"
                    },{
                        "label":"翻译名称:",
                        "name":"display_name"
                    },{
                        "label":"介绍:",
                        "name":"description"
                    },{
                        "label":"权限:",
                        "name":"flag"
                    },{
                        "label":"等级:",
                        "name":"level",
                    }
                ]
            });
            $('#crudtable').dataTable({
                "sDom":"<'row'<'col-sm-6'T><'col-sm-6'f>r>t<'row'<'col-sm-6'i><'col-sm-6'p>>",
                "sAjaxSource":"/admin/user/role/get",
                "bServerSide": false,
                "bAutoWidth": false,
                "bDestroy": true,
                "aoColumns":[
                    { "mData":"id" },
                    { "mData":"name" },
                    { "mData":"display_name" },
                    { "mData":"description" },
                    { "mData":"flag", "sClass":"center" },
                    { "mData":"level", "sClass":"center" },
                    { "mData":"updated_at" },
                ],
                "oTableTools":{
                    "sRowSelect":"multi",
                    "aButtons":[
                        { "sExtends":"editor_create", "editor":editor },
                        { "sExtends":"editor_edit", "editor":editor },
                        { "sExtends":"editor_remove", "editor":editor }
                    ]
                },
                "language": {
                    "lengthMenu": "_MENU_"
                }
            });
        })
    </script>
@endsection